﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using TrainingManagement.api.Models.BusinessLogic;
using TrainingManagement.api.Models.BusinessLogic.TrainingRecord;
using TrainingManagement.api.Models.BusinessObjects;

namespace TrainingManagement.api.Controllers
{
    public class TrainingRecordController : ApiController
    {
        public TrainingRecord PutTrainingRecord(TrainingRecord trainingRecord)
        {
            return new TrainingRecordCreateOperation().Run(trainingRecord);
        }

        [System.Web.Http.ActionName("Update")]
        public void PostUpdateTrainingRecord(TrainingRecord trainingRecord)
        {
            new TrainingRecordUpdateOperation().Run(trainingRecord);
        }

        [System.Web.Http.ActionName("CompletePending")]
        public void PostCompletePending(TrainingRecord trainingRecord)
        {
            new TrainingRecordCompletePendingOperation().Run(trainingRecord);
        }

        public void DeleteTrainingRecord(int trainingRecordId)
        {
            new TrainingRecordDeleteOperation().Run(trainingRecordId);
        }

        [System.Web.Http.ActionName("Employee")]
        public List<TrainingRecord> GetTrainingRecordByEmployee(int employeeId)
        {
            return new TrainingRecordByEmployeeOperation().Run(employeeId);
        }

        [System.Web.Http.ActionName("RecordId")]
        public TrainingRecord GetTrainingRecordByRecordId(int recordId)
        {
            return new TrainingRecordByRecordIdOperation().Run(recordId);
        }
    }
}
